﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using VCN.App.DataAccessLayer;
using System.Web.Services;

namespace VCN.home
{
    public partial class Gallery : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }
        public int GetId()
        {
            int v_id;
            ProductDAO v_ProductDAO = new ProductDAO();
            if (v_ProductDAO.selectAll2Dt().Rows.Count != 0)
            {
                v_id = int.Parse(v_ProductDAO.selectAll2Dt().Rows[0][0].ToString());
                return v_id;
            }
            return 0;
        }
        public int GetProductId(int ip_id)
        {
            int op_id;
            ProductDAO v_ProductDAO = new ProductDAO();
            DataTable v_dt=v_ProductDAO.SelectByCategoryId(ip_id);
            if (v_dt.Rows.Count != 0)
            {
                op_id = int.Parse(v_dt.Rows[0][0].ToString());
                return op_id;
            }
            return 0;

        }
        // Ham lay anh hien tren slide o trang chu
        [WebMethod]
        public string get_image_slide(int ip_no)
        {
            VCN.App.DataAccessLayer.ImageSlideDAO v_img_dao = new VCN.App.DataAccessLayer.ImageSlideDAO();
            VCN.App.DataTransferObjects.ImageSlide v_img_obj = new VCN.App.DataTransferObjects.ImageSlide();
            DataTable v_dt = new DataTable();
            v_dt = v_img_dao.SelectByOrder(ip_no);
            if (v_dt.Rows.Count == 0)
                v_dt = v_img_dao.SelectByOrder(1);
            return v_dt.Rows[0]["IMAGE"].ToString();
        }
    }
}
